import datetime
# import functools

# def user_login_data(f):
#     @functools.wraps(f)
#     def wrapper(*args, **kwargs):
#         return f(*args, **kwargs)
#
#     return wrapper


# @app.route('/news/<int:news_id>')
# @user_login_data
# def num1():
#     print("aaa")
#
#
# # @app.route('/')
# @user_login_data
# def num2():
#     print("bbbb")
#
# if __name__ == '__main__':
#     print(num1.__name__)
#     print(num2.__name__)
# import random
#
# from info import db
# from info.models import User
# from manager import app
#
#
# def add_test_users():
#     # 初始化用户列表
#     users = []
#     #　现在的时间
#     now = datetime.datetime.now()
#     for num in range(0, 10000):
#         try:
#             # 初始化user模型对象
#             user = User()
#             # 用户的昵称，默认是11位，不足的话前面补０
#             user.nick_name = "%011d" % num
#             # 用户的手机号，默认11为，不足的话前面补0
#             user.mobile = "%011d" % num
#             # 给密码加密
#             user.password_hash = "pbkdf2:sha256:50000$SgZPAbEj$a253b9220b7a916e03bf27119d401c48ff4a1c81d7e00644e0aaf6f3a8c55829"
#             # 用户的最后登录时间，现在时间减去随机的秒数
#             user.last_login = now - datetime.timedelta(seconds=random.randint(0, 2678400))
#             # 把user模型对象添加到用户列表中
#             users.append(user)
#             print(user.mobile)
#         except Exception as e:
#             print(e)
#     # 手动开启一个app的上下文
#     with app.app_context():
#         db.session.add_all(users)
#         db.session.commit()
#     print('OK')
#
#
# if __name__ == '__main__':
#     add_test_users()

import time
from datetime import datetime
mon_count = 0
now = time.localtime()
print(now)
mon_begin = '%d-%02d-01' % (now.tm_year, now.tm_mon)
print(mon_begin)
mon_begin_date = datetime.strptime(mon_begin, '%Y-%m-%d')
print(mon_begin_date)
begin_mon_date = datetime.strptime(('%d-%02d-01' % (now.tm_year, now.tm_mon)), "%Y-%m-%d")
print(begin_mon_date)
begin_day_date = datetime.strptime(('%d-%02d-%02d' % (now.tm_year, now.tm_mon, now.tm_mday)), "%Y-%m-%d")
print(begin_day_date)